package com.google.memoryofaplace;

public class Codes {
	public enum Status {
		DRAFT(0), PUBLISHED(1), DELETED(-1);
		private int code;

		private Status(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static Status find(int code) {
			for (Status status : Status.values()) {
				if (status.code == code)
					return status;
			}
			return null;
		}

		public static Status find(long code) {
			for (Status status : Status.values()) {
				if (status.code == code)
					return status;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}

	}

	public enum PlaceType {
		PLACE_TYPE_1(1), PLACE_TYPE_2(2), PLACE_TYPE_3(3);
		private int code;

		private PlaceType(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static PlaceType find(int code) {
			for (PlaceType placeType : PlaceType.values()) {
				if (placeType.code == code)
					return placeType;
			}
			return null;
		}

		public static PlaceType find(long code) {
			for (PlaceType placeType : PlaceType.values()) {
				if (placeType.code == code)
					return placeType;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}
	}

	public enum PlaceCategoryType {
		PLACE_CATEGORY_TYPE_1(1), PLACE_CATEGORY_TYPE_2(2), PLACE_CATEGORY_TYPE_3(
				3);
		private int code;

		private PlaceCategoryType(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static PlaceCategoryType find(int code) {
			for (PlaceCategoryType placeCategoryType : PlaceCategoryType
					.values()) {
				if (placeCategoryType.code == code)
					return placeCategoryType;
			}
			return null;
		}

		public static PlaceCategoryType find(long code) {
			for (PlaceCategoryType placeCategoryType : PlaceCategoryType
					.values()) {
				if (placeCategoryType.code == code)
					return placeCategoryType;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}

	}

	public enum UserType {
		ADMIN(1), EDITOR(2);
		private int code;

		private UserType(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static UserType find(int code) {
			for (UserType userType : UserType.values()) {
				if (userType.code == code)
					return userType;
			}
			return null;
		}

		public static UserType find(long code) {
			for (UserType userType : UserType.values()) {
				if (userType.code == code)
					return userType;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}

	}

	public enum MediaType {
		BEFORE(1), AFTER(2), NOW(3);
		private int code;

		private MediaType(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static MediaType find(int code) {
			for (MediaType mediaType : MediaType.values()) {
				if (mediaType.code == code)
					return mediaType;
			}
			return null;
		}

		public static MediaType find(long code) {
			for (MediaType mediaType : MediaType.values()) {
				if (mediaType.code == code)
					return mediaType;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}

	}

	public enum MediaContentType {
		IMAGE(1), VIDEO(2);
		private int code;

		private MediaContentType(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static MediaContentType find(int code) {
			for (MediaContentType mediaContentType : MediaContentType.values()) {
				if (mediaContentType.code == code)
					return mediaContentType;
			}
			return null;
		}

		public static MediaContentType find(long code) {
			for (MediaContentType mediaContentType : MediaContentType.values()) {
				if (mediaContentType.code == code)
					return mediaContentType;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}

	}

	public enum CommentType {
		PLACE(1), GENERAL(2);
		private int code;

		private CommentType(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static CommentType find(int code) {
			for (CommentType commentType : CommentType.values()) {
				if (commentType.code == code)
					return commentType;
			}
			return null;
		}

		public static CommentType find(long code) {
			for (CommentType commentType : CommentType.values()) {
				if (commentType.code == code)
					return commentType;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}

	}

	public enum DenounceObjectType {
		COMMENT(1), MEDIA(2);
		private int code;

		private DenounceObjectType(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static DenounceObjectType find(int code) {
			for (DenounceObjectType denounceObjectType : DenounceObjectType
					.values()) {
				if (denounceObjectType.code == code)
					return denounceObjectType;
			}
			return null;
		}

		public static DenounceObjectType find(long code) {
			for (DenounceObjectType denounceObjectType : DenounceObjectType
					.values()) {
				if (denounceObjectType.code == code)
					return denounceObjectType;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}

	}

	public enum DenounceType {
		TYPE1(1), TYPE2(2), TYPE3(3), TYPE4(4);
		private int code;

		private DenounceType(int c) {
			code = c;
		}

		public int getCode() {
			return code;
		}

		public static DenounceType find(int code) {
			for (DenounceType denounceType : DenounceType.values()) {
				if (denounceType.code == code)
					return denounceType;
			}
			return null;
		}

		public static DenounceType find(long code) {
			for (DenounceType denounceType : DenounceType.values()) {
				if (denounceType.code == code)
					return denounceType;
			}
			return null;
		}

		public String toString() {
			return name().toString();
		}

	}

}
